Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output cache versioning #2309

Merged

Conversation

Igloczek
Copy link
Contributor

Short description and why it's useful

Currently, the cache is persisted in Redis until the expiration, which can lead to issues with serving old content after deployment, if this cache will not be manually cleaned.

These changes are related to the build process and redis-tag-cache package setup.

In the first step during the server build, I generate the UUID and save it to core/build/cache-version.json file.

Then when the server is firing up, it reads saved previously UUID and uses it to set keyPrefix which help us distinguish the correct version of the cache.

Why not generate UUID directly in server.js? We can spawn multiple instances of this server, so each of them will have on the cache, which is not efficient.

Upgrade Notes and Changelog

There are no changes required, just under the hood magic, but if someone was currently clearing all the cache during deployment, it's not necessary anymore.

Questions

If manual cache clearing is not so useful anymore, should be kept yarn cache and core/script/cache.js?
If we should keep it, it also needs to read the content of cache-version.json, so maybe will be good to abstract the logic of creating cache instance 馃

@Igloczek Igloczek requested a review from pkarw January 30, 2019 16:05
@pkarw pkarw merged commit 9014614 into vuestorefront:hotfix/v1.7.3 Jan 31, 2019
@pkarw
Copy link
Collaborator

pkarw commented Jan 31, 2019

That's cool. So we're clearing the cache with each build

@Igloczek
Copy link
Contributor Author

@pkarw what about the questions part? I'd like to make it consistent and easy to use.

@Igloczek Igloczek deleted the feature/srr-cache-versioning branch January 31, 2019 18:02
@pkarw
Copy link
Collaborator

pkarw commented Feb 1, 2019

I think that yarn cache is still useful and we should add the cache-version.json support to it

@pkarw
Copy link
Collaborator

pkarw commented Feb 1, 2019

The cache command could be still useful as the cacheKey is regenerated only while buildinf the app

@pkarw pkarw added this to the 1.8 milestone Feb 2, 2019
@patzick patzick removed this from the 1.8 milestone Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants